package com.example.demo.service.imp;

import com.example.demo.entity.AlarmPlatform;
import com.example.demo.entity.Rule;
import com.example.demo.mapper.AlarmPlatformMapper;
import com.example.demo.mapper.RuleMapper;
import com.example.demo.service.AlarmPlatformService;
import com.example.demo.service.RuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AlarmPlatformImp implements AlarmPlatformService {

    @Autowired
    private AlarmPlatformMapper alarmPlatformMapper;

    @Override
    public List<AlarmPlatform> getAll() {
        return alarmPlatformMapper.getAll();
    }


    @Override
    public boolean create(AlarmPlatform alarmPlatform) {
        alarmPlatform.init();
       int affectRows = alarmPlatformMapper.insert(alarmPlatform);
        return affectRows>0;
    }


    @Override
    public boolean update(AlarmPlatform alarmPlatform) {
        int affectRows = alarmPlatformMapper.updateById(alarmPlatform);
        return affectRows>0;
    }

    @Override
    public boolean delete(String uuid) {
        int affectRows = alarmPlatformMapper.deleteById(uuid);
        return affectRows>0;
    }
}
